package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tanhua.dubbo.api.db.PersonalityApi;
import com.tanhua.dubbo.api.mapper.PersonalityMapper;
import com.tanhua.model.db.Personality;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * @author lamy
 * @version 1.0
 * @ClassName: PersonalityApiImpl
 * @date 2021-12-27 16:59:03
 */

//人格表接口实现类
@DubboService
public class PersonalityApiImpl implements PersonalityApi {
    @Autowired
    private PersonalityMapper personalityMapper;

    @Override
    public Personality findPersonality(int totalScore) {
        QueryWrapper queryWrapper = new QueryWrapper<>();
        queryWrapper.le("min_score", totalScore);
        queryWrapper.ge("max_score", totalScore);

        return personalityMapper.selectOne(queryWrapper);
    }
}
